function pageinit() {
	// console.log("editDirApk page init");

	$("#editTaskForPlan #selectedSelectAll").off('click').on(
			'click',
			function(event) {
				$("#editTaskForPlan #selectedListView").find("li").each(
						function() {
							// console.log("selectedListView find li");
							var li = $(this);
							var checkBox = li.find("input");
							// console.log(checkBox);
							if (checkBox) {
								// console.log("checkBox ok");
								checkBox.prop('checked', true).checkboxradio(
										'refresh');
							}
						});
			});

	$("#editTaskForPlan #selectedDeselectAll").off('click').on(
			'click',
			function(event) {
				$("#editTaskForPlan #selectedListView").find("li").each(
						function(i, a) {
							var li = $(this);
							var checkBox = li.find("input");
							if (checkBox) {
								checkBox.prop('checked', false).checkboxradio(
										'refresh');
							}
						});
			});

	$("#editTaskForPlan #selectedDelete").off('click').on(
			'click',
			function(event) {
				var ids = [];
				var allcnt = 0;
				var msgStr = '';
				$("#editTaskForPlan #selectedListView").find("li").each(
						function() {
							allcnt = allcnt + 1;
							var li = $(this);
							var checkBox = li.find("input");
							if (checkBox && !checkBox.is(':checked')) {
								var id = checkBox.parent().parent().attr('id');
								var name = checkBox.parent().text();
								ids.push(id);
								msgStr += name;
							}
						});

				if (ids.length == allcnt) {
					showMsgPopup("no apk to be delete!");
				} else {
					var apks = {};
					apks.dir = dirName;
					apks.ids = ids;
					$.ajax({
						url : ('/_editDirApk'),
						type : 'POST',
						data : apks,
						success : function(result) {
							if (result.error) {
								showMsgPopup('_editDirApk failed:'
										+ result.error);
							} else {
								location.reload();
							}
						},
						error : function(_, status, e) {
							showMsgPopup('_editDirApk failed:' + e);
						}
					});
				}

			});

	$("#editTaskForPlan #remainSelectAll").off('click').on(
			'click',
			function(event) {
				$("#editTaskForPlan #remainListView").find("li").each(
						function() {
							// console.log("selectedListView find li");
							var li = $(this);
							var checkBox = li.find("input");
							// console.log(checkBox);
							if (checkBox) {
								// console.log("checkBox ok");
								checkBox.prop('checked', true).checkboxradio(
										'refresh');
							}
						});
			});

	$("#editTaskForPlan #remainDeselectAll").off('click').on(
			'click',
			function(event) {
				$("#editTaskForPlan #remainListView").find("li").each(
						function(i, a) {
							var li = $(this);
							var checkBox = li.find("input");
							if (checkBox) {
								checkBox.prop('checked', false).checkboxradio(
										'refresh');
							}
						});
			});

	$("#editTaskForPlan #selectedAdd").off('click').on(
			'click',
			function(event) {
				var ids = [];
				var msgStr = '';
				$("#editTaskForPlan #remainListView").find("li").each(
						function() {
							// console.log("selectedAdd find li");
							var li = $(this);
							var checkBox = li.find("input");
							if (checkBox && checkBox.is(':checked')) {
								// console.log("checkbox is checked");
								var id = checkBox.parent().parent().attr('id');
								var name = checkBox.parent().text();
								ids.push(id);
								msgStr += name;
							}
						});

				if (ids.length < 1) {
					showMsgPopup("no tasks to be add !");
				} else {
					$("#editTaskForPlan #selectedListView").find("li").each(
							function() {
								var li = $(this);
								var checkBox = li.find("input");
								if (checkBox) {
									var id = checkBox.parent().parent().attr(
											'id');
									var name = checkBox.parent().text();
									ids.push(id);
									msgStr += name;
								}
							});

					console.log("ids: " + ids);
					console.log("planId: " + __planId);
					var plan = {};
					plan.tasksId = ids;
					plan.planId = __planId;
					$.ajax({
						url : ('/_saveTasksForPlan'),
						type : 'POST',
						data : plan,
						success : function(result) {
							if (result === "ok") {
								location.reload();
							} else {
								showMsgPopup('_saveTasksForPlan failed:'
										+ result.error);
							}
						},
						error : function(_, status, e) {
							showMsgPopup('_saveTasksForPlan failed:' + e);
						}
					});
				}

			});
}
$(document).on('pageinit', function() {
	pageinit();
});